I agree with most of what szymczyk answered above.
Here are a few little tips I've learned while building a multi-platform app for several months.
If you used UIKit functions, you need to customize them for AppKit. (UIImage, UIApplication, UIColor)
Since fullScreenCover is not supported on macOS, it is best to use sheet if possible.
When using lists on macOS, it looks better to use .formStyle(.grouped).
Depending on the version of macOS, if there is a problem with the list in the Form not scrolling, it must be wrapped in a ScrollView. No problem in the latest version
You need to create a routine that corresponds to iOS' swipe action.
You will need to modify routines related to keyboard input. (keyboardType, keyDown)
If you have already created a UI for iPad landscape mode, I think you will be able to easily create an app for macOS. Even if the UI is created with the same code, testing must be done separately. In particular, there were many small bugs in NavigationSplitView on the iPad, and Apple has neglected them for a long time.
Post
Replies
Boosts
Views
Activity
I think the only way is to share information with the app through App Group or URL parameters and process the desired task in the app.
A long time ago, there were ways to get information about running processes in iOS, but they have all been abandoned.
In my case, I didn't have this problem until XCode 15 beta 7.
The problem was not resolved in XCode 15.0 beta 8.
@Observable is a very nice macro.
However, errors occur even in such simple code, so using @Observable is a very dangerous choice.
I too have the same problem.
If I change the existing ObservableObject class to @Observable I get the same error when selecting an item from the sidebar.
After seeing this error it seems @Observable is still unstable.
And this problem occurs on iPad and works fine on macOS.
I'm tired of how many years this bug lasts.
.timer had a long time alignment bug in widgets and had to use "multilineTextAlignment".
We hoped this could be fixed in this update, but rather added a bigger bug.
Developers modifying this module don't seem to be testing on widgets.
It's time for the official version to be released soon, and I'm worried that it will be released without fixing any bugs.
I am also having the same problem.
XCode 13.2.1, watchOS 8.3
It works normally in iOS and macOS, but the "status" value is empty in watchOS.
This issue is the same on the simulator and the device.
struct MPTextField: View {
let title: String
@Binding var text: String
@State private var isEditing: Bool = false
private var isClear: Bool {
return self.isEditing && !self.text.isEmpty
}
init(_ title: String, text: Binding<String>) {
self.title = title
self._text = text
}
var body: some View {
ZStack(alignment: .trailing) {
TextField(self.title,
text: self.$text) { isEditing in
self.isEditing = isEditing
} onCommit: {
self.isEditing = false
}
.padding(.trailing, self.isClear ? 18 : 0)
if self.isClear {
Button {
self.text = ""
} label: {
Image(systemName: "multiply.circle.fill").foregroundColor(.secondary)
}
.buttonStyle(PlainButtonStyle())
}
}
.frame(alignment: .trailing)
}
}
I have the same problem.
I struggled with the same problem.
My problem was caused by sharing WiFi of iMac.
The most obvious solution seems to be to disable the WiFi of the mac running XCode and use the wired network.
XCode : 12.3
macOS: 11.0.1
iMac : 2019